#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int N=2e5+10;
#define INF 0x3f3f3f3f;
typedef long long int ll;
#define close(); std::ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
//----------------------------------------------------------------------------//
int a[20],b[20];
void solve()
{
	 int n;
        cin >> n;
        for (int i = 1; i <= n; ++i) 
		{
            cin >> a[i];
        }
        int res = 0;
        for (int i = 1; i <= n; ++i) 
		{
            memcpy(b, a, sizeof(a));
            for (int j = 1; j <= n; ++j) 
			{
                if (i == j) continue;
                while (b[j] % 2 == 0) 
				{
                    b[j] >>= 1;
                    b[i] <<= 1;
                }
            }
            int sum = 0;
            for (int j = 1; j <= n; ++j) 
			{
                sum += b[j];
            }
            res = max(res, sum);
        }
        cout << res << '\n';
}
int main()
{
	close();
	int T; cin>>T;
	while (T--) solve();
	return 0;
}

